home *** CD-ROM | disk | FTP | other *** search
- /********************************************************* DEFINITION
- DATE: 10/17/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPScrollArea
-
- SUPERCLASS: CPPVisualObject
-
- This C++ class manages a scrollable area
-
- ********************************************************************/
-
-
- #pragma once
-
- #include <CPPVisualObject.h>
-
- class CPPWindow;
-
- class CPPScrollArea : public CPPVisualObject{
- public:
-
- CPPScrollArea (CPPWindow *OurWindow,
- Rect *ViewArea,
- Rect *DestArea,
- Boolean UseHScroll = TRUE,
- Boolean UseVScroll = TRUE,
- short hStep = 10,
- short vStep = 10);
- CPPScrollArea (CPPWindow *OurWindow,
- Boolean UseHScroll = TRUE,
- Boolean UseVScroll = TRUE,
- short hStep = 10,
- short vStep = 10);
- ~CPPScrollArea (void);
-
- virtual char *ClassName (void);
-
- virtual Boolean DoCommand (short commandID);
-
- virtual void DoCut (void);
- virtual void DoCopy (void);
- virtual void DoPaste (void);
- virtual void DoClear (void);
- virtual void DoSelectAll (void);
-
- virtual void Activate (Boolean nowActive);
- virtual Boolean DoClick (EventRecord *theEvent);
- virtual void DoIdle (void);
- Rect *GetAreaRect (void);
- virtual Rect *GetBounds (void);
-
- void Draw (void);
- virtual void DrawContents (void);
- virtual void MakeVisible (Boolean nowVisible);
- virtual void TargetHilite (Boolean makeTarget);
-
-
- void Area2Local (Point *thePoint);
- void Local2Area (Point *thePoint);
- void Area2Global (Point *thePoint);
- void Global2Area (Point *thePoint);
-
- void SetHorizontalStep (short stepSize);
- void SetVerticalStep (short stepSize);
-
- void MoveScrollArea (void);
-
- long AreaWidth (void);
- long AreaHeight (void);
- long ViewWidth (void);
- long ViewHeight (void);
-
- void AutoScroll (void);
-
- protected:
- Rect areaRect, // the visible area in window coordinates
- destRect, // the entire size of the area we control
- viewRect, // the visible area in destRect coords
- selRect, // the current selection in destRect coords
- bounds; // temp variable used in GetBounds
- ControlHandle HScroll;
- ControlHandle VScroll;
- Boolean hasSelection;
-
- virtual Boolean DoScrollAreaClick (Point clickPt, short modifiers);
- virtual void ResizeContent (short newWidth, short newHeight);
- virtual void MoveContent (short newH, short newV);
-
- void MakeSelection (Rect *newSelection);
- void RemoveSelection (void);
- virtual void HiliteSelection (Boolean doHilight);
- virtual void IdleSelection (void);
-
- private:
- short hStep;
- short vStep;
-
- static CPPScrollArea *gCurrentArea;
- static ControlHandle gVScroll;
- static ControlHandle gHScroll;
-
- // static class methods
- static pascal void Scroll_Right (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Left (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Up (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Down (ControlHandle theControl,
- short ctlPart);
-
- void VPageScroll (long part, long direction);
- void HPageScroll (long part, long direction);
- void AdjustScrollBar (void);
- void DoVScroller (Point clickPt, short part);
- void DoHScroller (Point clickPt, short part);
-
- void MakeCPPScrollArea (CPPWindow *OurWindow,
- Rect *ViewArea,
- Rect *DestArea,
- Boolean UseHScroll,
- Boolean UseVScroll,
- short hStep,
- short vStep);
-
- };